test(settings): destructive + account flow coverage for SettingsDialog (TCD-05)#1061
Conversation
…g (TCD-05) SettingsDialog owns the destructive privacy actions and the account flows, which had no render coverage (only the inert-preferences markers were tested). Add @testing-library/react tests for the wiring that matters: - Clear recent searches invokes clearRecentQueries (enabled only with a non-zero count). - Clear saved items invokes accountData.clearFavourites and surfaces the "Saved items cleared." status notice. - Sign out invokes the onSignOut callback. - Email sign-in submits the entered address to auth.signInWithEmail. Reuses the settings-inert-preferences harness shape: the data/auth/account hooks are mocked so the flows are asserted without real storage or auth; useTheme/useAppPreferences run unmocked in jsdom. Verified: 4/4 pass; typecheck, lint, format:check clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdded a Vitest and React Testing Library suite for ChangesSettings dialog action tests
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 686770bbbf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/settings-dialog-actions.dom.test.tsx`:
- Around line 14-15: Update the test setup around countRecentQueries to accept a
configurable count, then render the settings dialog with a count of 0 in an
additional test case. Assert that the “Clear recent searches” action is
disabled, while preserving the existing enabled-state assertion for a nonzero
count.
- Around line 11-43: Move the clearRecentQueries, clearFavourites, and
signInWithEmail spies into vi.hoisted so the vi.mock factories can safely
reference them during module initialization, while preserving their current mock
behavior. If this suite covers disabled actions, also add coverage for
countRecentQueries returning 0 and verify “Clear recent searches” is disabled.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c177022d-16b1-48c5-8edd-05f423da7162
📒 Files selected for processing (1)
tests/settings-dialog-actions.dom.test.tsx
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 1 file(s) based on 2 unresolved review comments. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 1 file(s) based on 2 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #4345 (success). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
format:check is a required CI gate and is not part of verify:cheap, so this slipped through the local run. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
Adds render coverage for
SettingsDialog's destructive privacy actions and account flows (finding TCD-05). The dialog previously had only inert-preferences-marker coverage; the flows that actually mutate state or auth were untested. Test-only, no product code changes.clearRecentQueries(and is disabled when the count is zero).accountData.clearFavouritesand surfaces the"Saved items cleared."status notice.onSignOutcallback.auth.signInWithEmail.Reuses the harness shape from
settings-inert-preferences.dom.test.tsx: the data-storage, auth, and account-data hooks are mocked so the flows are asserted without touching real storage or auth, whileuseTheme/useAppPreferencesrun unmocked in jsdom.Verification
tests/settings-dialog-actions.dom.test.tsx— 4/4 pass (jsdom)npm run typecheck,npm run lint,npm run format:checkcleanRisk and rollout
Clinical Governance Preflight
(Touches only a test that mocks the auth hook; no auth/privacy behaviour changes.)
Clinical KB Database(sjrfecxgysukkwxsowpy)🤖 Generated with Claude Code
Summary by CodeRabbit